package StudyCode.summary.myfile;

import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.attribute.GroupPrincipal;
import java.nio.file.attribute.UserPrincipal;
import java.nio.file.attribute.UserPrincipalLookupService;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class GetUserPrincipalLookupServiceInstance {
	public static void main(String[] args) {
		try {
			UserPrincipalLookupService lookupService = FileSystems.getDefault()
					.getUserPrincipalLookupService();
			GroupPrincipal groupPrincipal = lookupService.lookupPrincipalByGroupName("Administrators");
			System.out.println(groupPrincipal.getName());
			UserPrincipal userPrincipal = lookupService.lookupPrincipalByName("haha");
			System.out.println(userPrincipal.getName());
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
